const {User} = require("../../models/User");

module.exports = async (req, res) => {
    const userId = req.query.user_id;
    var myfans =  [];
    try{
       const folRes = await User.findOne({user_id:userId},{fans:1,_id:0}).lean();
       let fanslen = folRes.fans.length;
       for(let i=0;i<fanslen;i++){
        const item = await User.findOne({user_id:folRes.fans[i].user_id},
            {user_id:1,nickname:1,avatar:1,signature:1}).lean();
            myfans.push(item);
    }
       res.send({errCode:"1",msg:"请求成功",data:{myfans:myfans}})
    }catch(e){
        console.log(e)
        res.status(400).send({errCode:"1",msg:"请先登录"})
    }
}